home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / qcmp114.arc / QCMP.DOC < prev    next >
Text File  |  1991-01-23  |  13KB  |  317 lines

  1.                                    QCMP 1.14
  2.                                    ---------
  3.  
  4.         Purpose
  5.         -------
  6.         QCMP compares two files, or two groups of files.  It is not
  7.         designed to isolate file differences, but simply to tell you
  8.         whether or not files are identical.  This can be used to verify
  9.         file-by-file backup operations, for smart batch files, in
  10.         Personal REXX programs, etc.  QCMP is similar to DOS's COMP
  11.         command except that (1) it doesn't display differences; (2) the
  12.         display is better suited for automated processing; and (3) it
  13.         returns a usable errorlevel.
  14.  
  15.         Version 1.13 adds SHARE support but makes no other changes.
  16.  
  17.         | indicates changes in recent versions.
  18.  
  19.  
  20.         Usage
  21.         -----
  22.         Here is the syntax for running QCMP:
  23.  
  24.             qcmp filespec1 filespec2 [-Dn] [-H] [-T]
  25.  
  26.         Usage is largely the same as DOS's COMP command except that
  27.         QCMP does not prompt for missing input, and the three option
  28.         switches are not found in COMP.  The optional switches can be
  29.         introduced by either a hypen (-) or a slash (/).
  30.  
  31.         Filespec1 can be any valid file or directory specification:
  32.  
  33.             d:                  Drive only
  34.             path                Path only
  35.             d:file.ext          Drive, filename, extension
  36.             path\file.ext       Path, filename, extension
  37.             d:path\file.ext     Drive:path. filename, extension
  38.  
  39.         If no drive is specified, the current drive is assumed.  If no
  40.         path is specified, the current directory for the selected
  41.         drive is assumed.
  42.  
  43.         If no filename is specified, "*.*" (all files) is assumed.
  44.  
  45.         If no extension is specified, "*" is assumed.  If you really
  46.         want to check a file that has no extension, use a single "."
  47.         with no extension.  For example, "foo" is assumed to be "foo.*",
  48.         but "foo." matches only a file called "foo" (not "foo.txt").
  49.  
  50.         Filespec2 is identical to filespec1 except that a missing
  51.         filename will default to the filename used in filespec1 rather
  52.         than "*.*".
  53.  
  54.         Examples:
  55.  
  56.             qcmp *.* b:
  57.                 Compare all files in current directory of current drive
  58.                 with files of the same name on drive B:
  59.  
  60.             qcmp a: b:
  61.                 Compare all files on drive A: to same files on drive B:.
  62.  
  63.             qcmp \asm\*.asm b:*.bak
  64.                 Compare all *.ASM files in \ASM directory of current
  65.                 drive to files with same root name but .BAK extension on
  66.                 drive B.
  67.  
  68.  
  69.         Display levels
  70.         --------------
  71.         The -D (Display level) switch affects the results messages that
  72.         are displayed.  Valid display levels are:
  73.  
  74.             -D0     No display; return errorlevel only.
  75.             -D1     Display results only for comparison errors
  76.             -D2     Display results for all files compared
  77.  
  78.         The -D0 level is intended for batch files and Personal REXX
  79.         programs (or other programs that can execute QCMP and examine
  80.         the result code).  The -D2 level is the default.
  81.  
  82.  
  83.         Checking the timestamp
  84.         ----------------------
  85.         If two files have identical contents, QCMP will normally
  86.         consider them to be the same even if their dates or times
  87.         differ.  However, if you use the -T switch, QCMP will also
  88.         compare the files' modification dates and times; if they are
  89.         different, the files are reported as being different, even if
  90.         their contents are the same.
  91.  
  92.  
  93.         Including hidden files
  94.         ----------------------
  95.         If you want to include hidden files such as IBMBIO.COM in your
  96.         comparisons, add the -H switch.  For example,
  97.  
  98.             qcmp -h c:\*.* b:
  99.  
  100.         would compare all of the files in the root directory of drive C
  101.         with copies on drive B, including hidden files (possibly,
  102.         IBMBIO.COM and IBMSYS.COM).  Without the -H, hidden files would
  103.         not be included.
  104.  
  105.  
  106.         Results (display)
  107.         -----------------
  108.         For each matching file, QCMP will display the following line:
  109.  
  110.             filespec1 - filespec2 > result
  111.  
  112.         where FILESPEC1 and FILESPEC2 are the two files currently being
  113.         compared, and RESULT is the comparison result.  RESULT is one of
  114.         the following:
  115.  
  116.             OK                  Files are identical
  117.             ERROR               Files are same size but not identical
  118.             SIZE DIFF           Files are different sizes
  119.             READ ERROR          Error reading one of the files.
  120.             DATE/TIME DIFF      Files' timestamps are different (this
  121.                                 error reported only if -T selected)
  122.             <file> NOT FOUND    Named file not found
  123.  
  124.         Note that the -D1 display level suppresses the display of files
  125.         for which the result is "OK".
  126.  
  127.  
  128.         Results (errorlevel)
  129.         --------------------
  130.         QCMP returns an errorlevel to DOS that describes the comparison
  131.         results.  Errorlevel are as follows:
  132.  
  133.             0       All files are identical (all "OK")
  134.             1       At least one comparison failed
  135.             254     No files found matching first filespec
  136.             255     Usage error, disk error, or insufficient memory
  137.  
  138.         Note that if you specify the -d0 display level, ONLY the error
  139.         level is returned; there is no display at all.  When -d0 is
  140.         specified, QCMP will terminate as soon as an errorlevel is
  141.         determined; for example, it will not bother to continue
  142.         comparing more files after one comparison fails, because the
  143.         errorlevel must be 1 regardless of the results of subsequent
  144.         comparisons.
  145.  
  146.  
  147.         Sample use: batch files
  148.         -----------------------
  149.         1. Branch to BACKUP if any *.ASM file in current drive is not
  150.         preperly backed up to B:*.BAK, else continue.
  151.  
  152.             qcmp -d0 *.asm b:*.bak
  153.             If errorlevel 255 goto QCERR
  154.             If errorlevel 254 goto NOFILES
  155.             If errorlevel 1 goto BACKUP
  156.             ... (all files OK)
  157.             ...
  158.             :BACKUP
  159.             ... (needs backup)
  160.             ...
  161.             :NOFILES
  162.             ... (no files match filespec1)
  163.             :QCERR
  164.             ... (error in qcmp, or no matching files)
  165.             ...
  166.  
  167.         2. Back up any file in current directory that needs backup to
  168.         drive B.  This requires two batch files, one called by the other
  169.         using the technique of executing another copy of COMMAND.COM
  170.         with the second batch file as a parameter.
  171.  
  172.             BAK.BAT:
  173.                 FOR %%a IN (*.*) DO command /c xxbak %%a
  174.  
  175.             XXBAK.BAT:
  176.                 qcmp -d0 %1 b:
  177.                 IF NOT errorlevel 1 GOTO OK
  178.                 echo Backing up %1
  179.                 copy %1 b:
  180.                 GOTO exit
  181.                 :OK
  182.                 echo %1 is backed up
  183.                 :EXIT
  184.  
  185.  
  186.         Sample use: Personal REXX
  187.         -------------------------
  188.         1. Determine whether all files in current directory were
  189.         backed up successfully to drive b:
  190.  
  191.             'qcmp -d0 *.* b:'
  192.             If rc = 0 Then
  193.                 Say 'All files backed up OK'
  194.             Else If rc = 1 Then
  195.                 Say 'Error in backup!'
  196.             Else If rc = 254 Then
  197.                 Say 'No Matching files'
  198.             Else If rc = 255 Then
  199.                 Say 'qcmp error!'
  200.  
  201.         2. Create a list of files that need to be backed up from the
  202.         current directory of drive C to drive B, and back them all up.
  203.         The sample code assumes that STACKDRV and STACKMGR are
  204.         installed; without the STK device, the same could be accomplised
  205.         by redirecting output to a temporary file, reading the file line
  206.         by line, and then deleting the file.
  207.  
  208.             'qcmp c: b: > stk'
  209.             If rc > 1 Then Do
  210.                 Say 'Error invoking qcmp'
  211.                 Exit
  212.             End
  213.  
  214.             count = 0
  215.             Do While lines('stk') > 0
  216.                 parse value linein('stk') with f1 ' - ' . ' > ' err
  217.                 If err <> 'OK' Then Do
  218.                     count = count+1
  219.                     file.count = f1
  220.                     error.count = err
  221.                 End
  222.             End
  223.  
  224.             If count = 0 Then
  225.                 Say 'All files backed up OK'
  226.             Else Do i = 1 To Count
  227.                 Say 'Backing up' file.i '(result = ' error.i')'
  228.                 'copy file.i b:'
  229.             End
  230.  
  231.         NOTE: after the WHILE loop, COUNT contains the number of compare
  232.         errors; FILE. contains an array of files not properly backed up,
  233.         and ERROR. contains the error text associated with FILE.
  234.         Indices to FILE. and ERROR. are the integers from 1 to COUNT.
  235.  
  236.  
  237.         Revision history
  238.         ----------------
  239.         Version 1.14 - 01/23/91
  240.             File sharing support released
  241.             Internal changes
  242.  
  243.         Version 1.13 - 09/11/89
  244.             Not released
  245.  
  246.         Version 1.12 - 04/03/89
  247.             Added -H switch
  248.             Corrected improper parsing of ".." directory when ".."
  249.                 evaluates to the root directory.
  250.  
  251.         Version 1.11 - 07/23/88
  252.             Corrected case sensitivity of -T switch ("it's always
  253.             something" - R. Roseannadanna)
  254.  
  255.         Version 1.10 - 07/06/88
  256.             Added -T switch.
  257.             Added default '*' extension
  258.             Protected from erroneous comparisons generated through use
  259.                 of file pathing utilities or DOS's APPEND command.
  260.             Protected from disk read errors.
  261.             Allowed '/' as well as '-' for switch character and removed
  262.                 position dependency of switches.
  263.  
  264.         Version 1.00 - 11/11/86
  265.             First public release
  266.  
  267.  
  268.         Copyright/License/Warranty
  269.         --------------------------
  270.         This document and the program file QCMP.EXE ("the software") are
  271.         copyrighted by the author.  The copyright owner hereby licenses
  272.         you to: use the software; make as many copies of the program and
  273.         documentation as you wish; give such copies to anyone; and
  274.         distribute the software and documentation via electronic means.
  275.         There is no charge for any of the above.
  276.  
  277.         However, you are specifically prohibited from charging, or
  278.         requesting donations, for any such copies, however made; and
  279.         from distributing the software and/or documentation with
  280.         commercial products without prior permission.  An exception is
  281.         granted to not-for-profit user's groups, which are authorized to
  282.         charge a small fee for materials, handling, postage, and general
  283.         overhead.  NO FOR-PROFIT ORGANIZATION IS AUTHORIZED TO CHARGE
  284.         ANY AMOUNT FOR DISTRIBUTION OF COPIES OF THE SOFTWARE OR
  285.         DOCUMENTATION, OR TO INCLUDE COPIES OF THE SOFTWARE OR
  286.         DOCUMENTATION WITH SALES OF THEIR OWN PRODUCTS.
  287.  
  288.         THIS INCLUDES A SPECIFIC PROHIBITION AGAINST FOR-PROFIT
  289.         ORGANIZATIONS DISTRIBUTING THE SOFTWARE, EITHER ALONE OR WITH
  290.         OTHER SOFTWARE, AND CHARGING A "HANDLING" OR "MATERIALS" FEE OR
  291.         ANY OTHER SUCH FEE FOR THE DISTRIBUTION.  NO FOR-PROFIT
  292.         ORGANIZATION IS AUTHORIZED TO INCLUDE THE SOFTWARE ON ANY MEDIA
  293.         FOR WHICH MONEY IS CHARGED.  PERIOD.
  294.  
  295.         There is no restriction on the use of this software in
  296.         commercial or institutional environments.
  297.  
  298.         No copy of the software may be distributed or given away without
  299.         this document; and this notice must not be removed.
  300.  
  301.         There is no warranty of any kind, and the copyright owner is not
  302.         liable for damages of any kind.  By using this free software,
  303.         you agree to this.
  304.  
  305.                       The software and documentation are
  306.  
  307.                      Copyright (C) 1986,1988,1989,1991 by
  308.                             The Cove Software Group
  309.                             Christopher J. Dunford
  310.                                  P.O. Box 1072
  311.                            Columbia, Maryland 21044
  312.  
  313.                                 (301) 992-9371
  314.                         CompuServe 76703,2002 [IBMNET]
  315.  
  316.          Personal REXX is a trademark of the Mansfield Software Group.
  317.